package com.hbsc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.web.context.WebApplicationContext;

import java.util.logging.Logger;

@EnableAutoConfiguration
@SpringBootApplication(scanBasePackages = { "com.hbsc"})
public class ApplicationBootstrap extends SpringBootServletInitializer {
	private static final Logger logger = Logger.getLogger(ApplicationBootstrap.class.getName());

	static{
		logger.info("Springboot Loading...");
	}

	public WebApplicationContext run(SpringApplication application) {
		WebApplicationContext context=super.run(application);
		logger.info("Springboot is started.");
		return context;
	}

	protected SpringApplicationBuilder confugure(SpringApplicationBuilder application){
		return application.sources(ApplicationBootstrap.class);
	}

	public static void main(String[] args) {
		Thread.currentThread().setName("hb-single-main");
		SpringApplication.run(ApplicationBootstrap.class, args);
		logger.info("Springboot is started.");

	}
}
